package org.u2ml.app.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

@Entity
@XStreamAlias("diagram")
public class ProjectDiagram extends ResponseData {

	@XStreamAsAttribute
	private Long oid;
	
	@XStreamAsAttribute
	private String name;
	
	@XStreamAsAttribute
	private String type;
	
	@XStreamAsAttribute
	@XStreamAlias("projectId")
	private Long projectId;
	
	transient private Project attachedProject;
	
	@Column(length=2147483647)
	private String layout;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getOid() {
		return oid;
	}
	public void setOid(Long oid) {
		this.oid = oid;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	public String getName() {
		return name;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getType() {
		return type;
	}

	@ManyToOne
	@JoinColumn(name="project_id")	
	public Project getAttachedProject() {
		return attachedProject;
	}
	
	public void setAttachedProject(Project attachedProject) {
		this.attachedProject = attachedProject;
	}
	
	
	public void setProjectId(Long projectId) {
		this.projectId = projectId;
	}
	public Long getProjectId() {
		return projectId;
	}
	
	public String getLayout() {
		return layout;
	}
	public void setLayout(String layout) {
		this.layout = layout;
	}
}
